import redis,random
from ronglian_sms_sdk import SmsSDK

accId = '8a216da882f1f59401835463b6491132'
accToken = 'ad8f510c3adb43cd947fce2e105763e1'
appId = '8a216da882f1f59401835463b7481139'


def sends(mobile):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    data=random.randint(100000,999999)
    r=redis.Redis(host='localhost',port=6379,db=6)
    r.set(mobile,data,ex=1200)
    datas=(data,'5')
    resp = sdk.sendMessage(tid, mobile, datas)
    print(resp)
    return resp